package com.sdweizan.sdk.bytedance.util;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;

import java.util.Map;

public class JsonUtils {

  public static <T> T transObject(Object source, TypeReference<T> typeReference) {
    return JSONObject.parseObject(JSONObject.toJSONString(source), typeReference);
  }

  public static Map<String, Object> transMap(Object source) {
    return JSONObject.parseObject(
        JSONObject.toJSONString(source), new TypeReference<Map<String, Object>>() {});
  }
}
